#ifndef BOUNDARY_BUILDING_H
#define BOUNDARY_BUILDING_H

namespace blue_sky{

	//enumeration of different boundary elements
	enum coords{
		X1, X2, Y1, Y2, 
	};
	
	template <class strategy_t>
	class build_boundary : public bs_node{
		typedef build_boundary<strategy_t>					this_t;

		typedef typename strategy_t::item_t					item_t;
		typedef typename strategy_t::rhs_item_t				rhs_item_t;

		typedef typename strategy_t::csr_matrix_t           csr_matrix_t;
		typedef smart_ptr <csr_matrix_t, true>              sp_csr_matrix_t;
		typedef typename csr_matrix_t::i_vector_type		i_vector_type;
		typedef typename csr_matrix_t::fp_vector_type		fp_vector_type;
		typedef typename csr_matrix_t::i_type				i_type;

		typedef rs_smesh_iface <strategy_t>                     smesh_iface_t;
		typedef smart_ptr <smesh_iface_t, true>                 sp_smesh_iface_t;
		typedef typename smesh_iface_t::index_point3d_t			index_point3d_t;

	public:

		//set matrix that contain information about cells
		void set_matrix(sp_csr_matrix_t  geom_matrix, int number_of_cells, 
			index_point3d_t dimens);

		//return vector of boundary cells
		i_vector_type get_boundary_cells();

		//return vector of non-boundary cells
		i_vector_type get_non_boundary_cells();

		//return map that contain different type of boundary elements
		std::map<coords, i_vector_type*> get_result_map();

		//fill missing elements in the result map
		void fill_boundary_geom ();

		//Blue-Sky declaration of build_boundary class
		BLUE_SKY_TYPE_DECL_T (build_boundary);
		
		index_point3d_t dimens; //dimensions of mesh
		fp_vector_type geom_factors; //geometrical factors in the geom_matrix
		int number_of_cells; //number of cells

	private:
		i_vector_type boundary_cells;	//vector of boundary cells
		i_vector_type non_boundary_cells; //vector of non-boundary cells
		//result map that contain info about type of cell
		std::map<coords, i_vector_type*> result; 
	};
}

#endif //BOUNDARY_BUILDING_H